package br.com.amadeus.android.adapters;

import java.util.List;

import br.com.amadeus.android.activities.home.R;
import br.com.amadeus.android.entities.Course;

import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.BaseAdapter;
import android.widget.ImageButton;
import android.widget.TextView;

public class MyCoursesListAdapter extends BaseAdapter {
	protected static final String CATEGORIA = "livro";
	private Context context;
	private List<Course> courseList;

	public MyCoursesListAdapter(Context context, List<Course> courseList) {
		super();
		this.context = context;
		this.courseList = courseList;
	}

	public int getCount() {
		return this.courseList.size();
	}

	public Object getItem(int pos) {
		Course course = this.courseList.get(pos);
		return course;
	}

	public long getItemId(int pos) {
		return pos;
	}

	public View getView(int pos, View view, ViewGroup viewGroup) {
		
		LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View v = inflater.inflate(R.layout.amadeus_my_courses_list_detail, null);
		
		Course course = this.courseList.get(pos);
		TextView tvCourse = (TextView) v.findViewById(R.id.tvCourseName);
		tvCourse.setText(course.getName());
	/*	//video libras
		ImageButton librasBt = (ImageButton)v.findViewById(R.id.botaoLibrasCurso);
	        librasBt.setOnClickListener(new OnClickListener() {
				
				public void onClick(View arg0) {
					Intent it = new Intent("ABRIR_LIBRAS");
					it.putExtra("video_libras", "HomeCourse.wmv");
					//v.startActivity(it);
					
				}
			});*/
		return v;
	}

}
